<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
    
  <meta name="description" content="love it" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    大前端 |  loveits
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
	  
  
<link rel="stylesheet" href="/css/main.css">

  
<link rel="stylesheet" href="/css/obsidian.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  
  
<link rel="stylesheet" href="//cdn.bootcss.com/codemirror/5.48.4/codemirror.min.css">

  
<link rel="stylesheet" href="//cdn.bootcss.com/codemirror/5.48.4/theme/dracula.css">

  
<link rel="stylesheet" href="//cdn.datatables.net/1.10.15/css/jquery.dataTables.css">

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/themes/default/style.min.css" />
  

  

</head>

</html>

<body>
  <div id="app">
  <main class="content">
  <section class="outer">
  <article id="post-bigfront/bf-1" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  大前端  
</h1>
  

    </header>
    
    
	
    
    <div class="article-meta">
      <a href="/p/78d8ffd6.html" class="article-date">
  <time datetime="2019-03-11T06:07:53.000Z" itemprop="datePublished">2019-03-11</time>
</a>
      <a href="#" class="article-updated">
  2020-12-16
</a>
      
  <div class="article-category">
    <a class="article-category-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/">大前端</a> / <a class="article-category-link" href="/categories/%E5%A4%A7%E5%89%8D%E7%AB%AF/%E6%9E%84%E5%BB%BA/">构建</a>
  </div>

      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.1k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">5分钟</span>
        </span>
    </span>
</div>

      
    </div>
    
    
    <blockquote class="excerpt">
	<span id="excerpt"></span>
</blockquote>

<script src='https://cdn.jsdelivr.net/npm/typed.js@2.0.11/lib/typed.min.js'></script>

<script>
	try {
		var typed = new Typed("#excerpt", {
			strings: ['千里之行，始于足下。——老子', '浪费时间是一桩大罪过。——卢梭', '学习永远不晚。——高尔基'],
			startDelay: 0,
			typeSpeed: 100,
			loop: true,
			backSpeed: 120,
			showCursor: true
		});
	} catch (err) {

	}

</script>

    
    

    
    <div class="sidebar-right">
	<!-- <div class="box">
		<ul>
		<li><a href="/">36 <p>文章</p></a></li>
		<li><a href="/categories">16 <p>分类</p></a></li>
		<li><a href="/tags">26 <p>标签</p></a></li>
		</ul>
	</div> -->
	
	    <div class="tocbot"></div>
	
</div>




    
    
    

    <div class="article-entry" itemprop="articleBody">
      
      
      <h2 id="一丶前言"><a href="#一丶前言" class="headerlink" title="一丶前言"></a>一丶前言</h2><h2 id="二丶安装"><a href="#二丶安装" class="headerlink" title="二丶安装"></a>二丶安装</h2><h3 id="安装-Node-js"><a href="#安装-Node-js" class="headerlink" title="安装 Node.js"></a>安装 Node.js</h3><p>Grunt 依赖 Node.js 所以在安装之前确保你安装了 Node.js。然后开始安装 Grunt。前往 <a href="http://nodejs.cn/download/" target="_blank" rel="noopener">Node.js官方下载页面</a>  下载安装。</p>
<h3 id="安装-Grunt-cli"><a href="#安装-Grunt-cli" class="headerlink" title="安装 Grunt-cli"></a>安装 Grunt-cli</h3><p>使用npm安装 Grunt-cli  <code>npm install -g grunt-cli</code></p>
<h2 id="三丶文件结构"><a href="#三丶文件结构" class="headerlink" title="三丶文件结构"></a>三丶文件结构</h2><pre><code>-src
-dist
-doc
-scss
-test
.gitignore
Gruntfile.js
package.json</code></pre><table>
<thead>
<tr>
<th>文件（夹）名</th>
<th align="right">描述</th>
<th align="center">备注</th>
</tr>
</thead>
<tbody><tr>
<td>.gitignore</td>
<td align="right">git忽略文件</td>
<td align="center">忽略node_modules 和</td>
</tr>
<tr>
<td>Gruntfile.js</td>
<td align="right">配置grunt语法文件</td>
<td align="center"></td>
</tr>
<tr>
<td>package.json</td>
<td align="right">Node.js 来描述一个项目的文件</td>
<td align="center"></td>
</tr>
<tr>
<td>src</td>
<td align="right">存放源码文件目录</td>
<td align="center"></td>
</tr>
<tr>
<td>dist</td>
<td align="right">存放最终产出文件</td>
<td align="center">编译后或者压缩后的代码</td>
</tr>
<tr>
<td>doc</td>
<td align="right">jsdoc导出的文件夹</td>
<td align="center"></td>
</tr>
<tr>
<td>scss</td>
<td align="right">存放scss文件</td>
<td align="center"></td>
</tr>
<tr>
<td>test</td>
<td align="right">存放测试文件</td>
<td align="center"></td>
</tr>
<tr>
<td>build</td>
<td align="right"></td>
<td align="center"></td>
</tr>
<tr>
<td>dest</td>
<td align="right">压缩之后的源码文件</td>
<td align="center">和src配套出现</td>
</tr>
</tbody></table>
<h3 id="gitignore"><a href="#gitignore" class="headerlink" title=".gitignore"></a>.gitignore</h3><p>git忽略文件，主要忽略node_modules文件夹。例如：</p>
<pre><code>.sass-cache
.DS_Store
node_modules
doc</code></pre><h3 id="package-json"><a href="#package-json" class="headerlink" title="package.json"></a>package.json</h3><p>package.json文件其实是 Node.js 来描述一个项目的文件,生成方式有2种：</p>
<ol>
<li>可以使用npm init生成，期间填写项目名称</li>
<li>复制已有文件</li>
</ol>
<pre><code class="json">{
  &quot;name&quot;: &quot;gruntxx&quot;,
  &quot;version&quot;: &quot;0.0.1&quot;,
  &quot;description&quot;: &quot;学习 grunt&quot;,
  &quot;repository&quot;: {
    &quot;type&quot;: &quot;git&quot;,
    &quot;url&quot;: &quot;https://gitee.com/zy_2016/gruntxx.git&quot;
  },
  &quot;author&quot;: &quot;loveit&quot;,
  &quot;license&quot;: &quot;MIT&quot;,
  &quot;bugs&quot;: {
    &quot;url&quot;: &quot;https://gitee.com/zy_2016/gruntxx.git/Issues&quot;
  },
  &quot;homepage&quot;: &quot;https://gitee.com/zy_2016/gruntxx.git&quot;,
  &quot;devDependencies&quot;: {
    &quot;grunt&quot;: &quot;^0.4.5&quot;,
    &quot;grunt-contrib-concat&quot;: &quot;^0.4.0&quot;,
    &quot;grunt-contrib-connect&quot;: &quot;^0.8.0&quot;,
    &quot;grunt-contrib-jshint&quot;: &quot;^0.10.0&quot;,
    &quot;grunt-contrib-sass&quot;: &quot;^0.7.4&quot;,
    &quot;grunt-contrib-uglify&quot;: &quot;^0.5.0&quot;,
    &quot;grunt-contrib-watch&quot;: &quot;^0.6.1&quot;
  }
}
</code></pre>
<p>其中<code>&quot;devDependencies&quot;: {}</code> 记录该项目依赖的所有插件。</p>
<h3 id="Gruntfile-js"><a href="#Gruntfile-js" class="headerlink" title="Gruntfile.js"></a>Gruntfile.js</h3><p>Gruntfile.js是使用grunt中最重要的配置文件。主要分成 <code>任务配置代码、插件加载代码、任务注册代码</code>。  </p>
<pre><code class="js">grunt.initConfig({
  //读取package.json文件
  pkg: grunt.file.readJSON(&#39;package.json&#39;),
  //任务配置代码
  uglify: {
    options: {
      banner: &#39;/*! &lt;%= pkg.name %&gt; &lt;%= grunt.template.today(&quot;yyyy-mm-dd&quot;) %&gt; */\n&#39;
    },
    build: {
      src: &#39;src/&lt;%= pkg.name %&gt;.js&#39;,
      dest: &#39;build/&lt;%= pkg.name %&gt;.min.js&#39;
    }
  }
  //插件加载代码
  grunt.loadNpmTasks(&#39;grunt-contrib-uglify&#39;);

  //任务注册代码
  grunt.registerTask(&#39;default&#39;, [&#39;uglify&#39;]);
});</code></pre>
<h2 id="四丶简单demo"><a href="#四丶简单demo" class="headerlink" title="四丶简单demo"></a>四丶简单demo</h2><p>做一个demo完成 <strong>多文件合并,压缩js文件</strong> 这些功能。  </p>
<p>可以clone <a href="#">gruntxxx - 更新中</a> 项目参考一下。</p>
<h3 id="建立文档结构"><a href="#建立文档结构" class="headerlink" title="建立文档结构"></a>建立文档结构</h3><ol>
<li>dist 最终js文件</li>
<li>src 存放源代码</li>
<li>package.json</li>
</ol>
<pre><code>{
  &quot;name&quot;: &quot;grunt_test&quot;,
  &quot;version&quot;: &quot;0.0.1&quot;,
  &quot;description&quot;: &quot;学习 grunt&quot;,
  &quot;repository&quot;: {
    &quot;type&quot;: &quot;git&quot;,
    &quot;url&quot;: &quot;#&quot;
  },
  &quot;author&quot;: &quot;loveit&quot;,
  &quot;license&quot;: &quot;MIT&quot;,
  &quot;bugs&quot;: {
    &quot;url&quot;: &quot;&quot;
  },
  &quot;homepage&quot;: &quot;&quot;,
  &quot;devDependencies&quot;: {
    &quot;@babel/core&quot;: &quot;^7.0.0&quot;,
    &quot;@babel/preset-env&quot;: &quot;^7.0.0&quot;,
    &quot;babel-eslint&quot;: &quot;^8.0.0&quot;,
    &quot;babel-preset-es2015&quot;: &quot;^6.24.1&quot;,
    &quot;grunt&quot;: &quot;^1.0.3&quot;,
    &quot;grunt-babel&quot;: &quot;^8.0.0&quot;,
    &quot;grunt-contrib-clean&quot;: &quot;^2.0.0&quot;,
    &quot;grunt-contrib-concat&quot;: &quot;~0.3.0&quot;,
    &quot;grunt-contrib-uglify&quot;: &quot;^4.0.0&quot;,
    &quot;grunt-contrib-watch&quot;: &quot;^1.1.0&quot;,
    &quot;grunt-jsdoc&quot;: &quot;^2.3.0&quot;,
    &quot;load-grunt-tasks&quot;: &quot;^4.0.0&quot;
  }
}
</code></pre><ol start="3">
<li>Gruntfile.js</li>
</ol>
<pre><code>module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON(&#39;package.json&#39;),
        concat: {
            options: {
                separator: &#39;;&#39;
            },
            dist: {
                src: [&#39;src/*.js&#39;],
                dest: &#39;dist/global.js&#39;
            }
        },
        uglify: {
            options: {
                banner: &#39;/*! &lt;%= pkg.name %&gt; - v&lt;%= pkg.version %&gt; - &lt;%= grunt.template.today(&quot;yyyy-mm-dd&quot;) %&gt; */&#39;
            },
            build: {
                src: &#39;dist/global.js&#39;,
                dest: &#39;dist/&lt;%=pkg.name%&gt;&lt;%pkg.version%&gt;.min.js&#39;
            }
        },
        clean: {
            build: {
                src: [&quot;dist/*&quot;]
            }
        },
        watch: {
          build:{
                files:[&#39;./global.js&#39;],
                tasks:[&#39;jsdoc&#39;],
                options:{
                    spawn:false
                }
            }
        }
    });
    grunt.loadNpmTasks(&#39;grunt-jsdoc&#39;);
    grunt.loadNpmTasks(&#39;grunt-contrib-clean&#39;);
    grunt.loadNpmTasks(&#39;grunt-contrib-concat&#39;);
    grunt.loadNpmTasks(&#39;grunt-contrib-uglify&#39;);
    grunt.loadNpmTasks(&#39;grunt-contrib-watch&#39;);


    grunt.registerTask(&#39;cleandist&#39;, [&#39;clean&#39;]);
    grunt.registerTask(&#39;default&#39;, [&#39;concat&#39;, &#39;uglify&#39;]);

}

</code></pre><h3 id="下载node-modules"><a href="#下载node-modules" class="headerlink" title="下载node_modules"></a>下载node_modules</h3><p>使用<code>npm install</code>下载对应的node模块。 </p>
<h3 id="执行"><a href="#执行" class="headerlink" title="执行"></a>执行</h3><p>使用<code>grunt</code>执行<code>grunt.registerTask(&#39;default&#39;, [&#39;concat&#39;, &#39;uglify&#39;]);</code>中约定的任务,使用<code>grunt cleandist</code>执行<code>grunt.registerTask(&#39;cleandist&#39;, [&#39;clean&#39;]);</code>中约定的任务。</p>
<hr>
<p>插件安装</p>
<ol>
<li>npm install grunt-contrib-uglify –save-dev</li>
<li>npm install grunt-contrib-watch –save-dev</li>
<li>npm install grunt-babel –save-dev //–dev grunt-babel @babel/core @babel/preset-env</li>
<li>npm install load-grunt-tasks –save-dev</li>
<li>npm install grunt-contrib-concat –save-dev</li>
<li>npm install grunt-contrib-clean –save-dev</li>
<li>npm install grunt-jsdoc –save-dev</li>
</ol>

     
      
    </div>

    

    <!-- copyright -->
    
    <br>
    <hr>
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>版权声明：</strong>
          自由转载-非商用-禁止演绎-保持署名
          （<a href="http://creativecommons.org/licenses/by-nc-nd/4.0/deed.zh" target="_blank" rel="noopener">CC BY-NC-ND 4.0</a>）
        </li>
        <li>
          <i class="ri-links-fill"></i>
          <strong>原文链接：</strong>
          <a href="http://loveits.cn/p/78d8ffd6.html " title="大前端 ">http://loveits.cn/p/78d8ffd6.html</a>
        </li>
      </ul>
    </div>


    
    <footer class="article-footer">
      
      
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://loveits.cn/p/78d8ffd6.html" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/grunt/" rel="tag">grunt</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/p/73f466e7.html" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            hexo的简单使用
          
        </div>
      </a>
    
    
      <a href="/p/8488fbd8.html" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">使用mysqldump对mysql数据库全量备份</div>
      </a>
    
  </nav>


  

  

  
  
<div class="gitalk" id="gitalk-container"></div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1.6.2/dist/gitalk.css">


<script src="https://cdn.jsdelivr.net/npm/gitalk@1.6.2/dist/gitalk.min.js"></script>


<script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.10.0/js/md5.min.js"></script>

<script type="text/javascript">
  var gitalk = new Gitalk({
    clientID: '09248ac3809d34e5aed0',
    clientSecret: '01a391e5c9fcc0e1b791dddfdbff490583cf878d',
    repo: 'gitalk',
    owner: 'loyalvi',
    admin: ['loyalvi'],
    // id: location.pathname,      // Ensure uniqueness and length less than 50
    //id: md5(location.pathname),
	id: location.pathname,
    distractionFreeMode: false,  // Facebook-like distraction free mode
    pagerDirection: 'last'
  })
	
  gitalk.render('gitalk-container')
</script>

  

</article>
</section>
  <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        <!-- loveits blog α -->
        &copy;
        2020
        loyalvi α
      </li>
	  <li>
	    
	    Powered by
	    
	    
	    <a href="https://hexo.io" target="_blank">Hexo</a> Theme <a href="https://github.com/Shen-Yu/hexo-theme-ayer" target="_blank">Ayer</a>
	    
	  </li>
      <!-- <li>
        联系方式（TODO）
      </li> -->
    </ul>
    <ul class="list-inline">
      <li>
        
      </li>
	  
	  
	  <li>
	    <a href="http://www.beian.miit.gov.cn/" target="_black">苏ICP备20008261号-1</a>
	  </li>
	  
	  
      <li>
        <!-- cnzz统计 -->
        
      </li>
	  
    </ul>
  </div>
</footer>
  <div class="to_top">
  <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
  </div>
  </main>
  <aside class="sidebar">
  <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/logo-white.png" alt="loveits"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">归档</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories/%E8%AE%A1%E5%88%92/">计划</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories/%E5%AD%97%E5%85%B8/">字典</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/todo">待办</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/p/9ff79b23.html">我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="搜索">
        <i class="ri-search-line"></i>
      </a>
      
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div> 
  </aside>
  <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
  
  
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/share.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/jquery.nicescroll.min.js"></script>

<script type="text/javascript" charset="utf8" src="http://cdn.datatables.net/1.10.15/js/jquery.dataTables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>

<script>
  try {
    var typed = new Typed("#subtitle", {
      strings: ['loveits blog', '中意他的博客', ''],
      startDelay: 0,
      typeSpeed: 100,
      loop: true,
      backSpeed: 100,
      showCursor: true
    });

  } catch (err) {
  }

</script>

<script>
//var nice = $("main").niceScroll();
	$('table').DataTable({
		"language": {
			"lengthMenu": "每页 _MENU_ 条记录",
			"zeroRecords": "没有找到记录",
			"info": "",
			"infoEmpty": "无记录",
			"infoFiltered": "(从 _MAX_ 条记录过滤)",
			"search":"搜索:"
		},
		"paging": false,
		searching: false,
		"columnDefs" : [ 
			{
			targets: [0],
			render: function(data, type, row, meta) {
				return  (meta.row + 1);
			}
			}],
        "order": [[4, 'asc']]	
	});			
</script>






<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: "auto",
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>

<script src="https://cdn.bootcss.com/codemirror/5.48.4/codemirror.min.js"></script>

    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/javascript/javascript.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/css/css.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/xml/xml.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/shell/shell.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/python/python.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/htmlmixed/htmlmixed.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/htmlembedded/htmlembedded.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/clike/clike.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/php/php.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/powershell/powershell.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/mode/yaml/yaml.min.js"></script>


    
<script src="//cdn.bootcss.com/codemirror/5.48.4/addon/mode/multiplex.min.js"></script>



<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/js/ayer.js"></script>



<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>




<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
	
  
  </div>
</body>

</html>